#ifndef IMAGEM_H
#define IMAGEM_H
#include <QFile>
#include <QDebug>
#include <QString>
#include <QByteArray>
#include <QColor>
#include <QVector>

#include <QGraphicsItem>

struct Cabecalho {
    short BfType;
    int BfSize;
    short BfReser1;
    short BfReser2;
    int BfOffSetBits;

    int BiSize;
    int BiWidth;
    int BiHeight;
    short BiPlanes;
    short BiBitCount;
    int BiCompress;
    int BiSizeImag;
    int BiXPPMeter;
    int BiYPPMeter;
    int BiClrUsed;
    int BiClrImpor;
};


class Imagem : public QGraphicsItem
{
public:
    Imagem();
    int getLargura ();
    int getAltura ();
    int getDeslocamento ();
    QColor getCor (int x, int y);
    void setLargura(unsigned int l);
    void setAltura(unsigned int a);
    void setDeslocamento(unsigned int d);
    void setCor (int x, int y, QColor c);
    QByteArray getBytes();
    bool AND(QString dir);
    bool OR(QString dir);

    bool ler(QString diretorio, QString *sobre);
    QColor** ler2(QString diretorio);

    QRectF boundingRect() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
    void updateMapa ();

private:
    int largura, altura, deslocamento;
    QColor** pixels;
    QPixmap mapa;
    Cabecalho c;

};

#endif // IMAGEM_H
